package jf.collections;

import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.HashSet;

/**
 * @author ivanalx
 * @date 29.05.2009 18:27:07
 */
public class HashSetX<A> extends AbstractSetX<A>{
	private Set<A> baseSet;
	public HashSetX(int capacity) {
		baseSet = new HashSet<A>(capacity);
	}

	public HashSetX() {
		baseSet = new HashSet<A>();
	}

	public HashSetX(Collection<? extends A> col) {
		baseSet = new HashSet<A>(col);
	}

	@Override
	public <A> SetX<A> createNewSet() {
		return new HashSetX<A>();
	}

	@Override
	public <A> SetX<A> createNewSet(int capacity) {
		return new HashSetX<A>(capacity);
	}

	@Override
	public <A> SetX<A> createNewSet(Collection<? extends A> col) {
		return new HashSetX<A>(col);
	}

	@Override
	protected Collection<A> getBaseCollection() {
		return baseSet;
	}

	@Override
	public Iterator<A> rightIterator() {
		return getBaseCollection().iterator();
	}
}
